#include "decaptcherfactory.hxx"
#include "mymutex.hxx"
#include <util.hxx>

DecaptcherFactory* DecaptcherFactory::_instance = 0;

DecaptcherFactory* DecaptcherFactory::Instance(void)
{
	static Mutex mutex;

	if (_instance == NULL)
	{
		Util::Lock lock(&mutex);

		if (_instance == NULL)
		{
			_instance = new DecaptcherFactory();
		}
	}
	
	return _instance;
}

bool DecaptcherFactory::RegisterDecaptcher(DecaptcherType Type, Decaptcher* decaptcher)
{
	decaptchers[Type] = decaptcher;

	return true;
}
Decaptcher* DecaptcherFactory::GetDecaptcher(DecaptcherType Type)
{
	return decaptchers[Type];
}

DecaptcherFactory::DecaptcherFactory()
:decaptchers()
{}